﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Supersense.content;
using Supersense.db;

public partial class admin_law_doupdate : System.Web.UI.Page
{
    private Database db = new Database();
    private News obj = new News();
    public DataTable detail;
    protected void Page_Load(object sender, EventArgs e)
    {
        string subject = Request.Form["subject"].Trim();
        string model = Request.Form["model"].Trim();
        string eventdate = Request.Form["eventdate"];
        int catid = Request.Form["catid"] == null ? 0 : Convert.ToInt32(Request.Form["catid"]);
        int type = Convert.ToInt32(Request.Form["type"].Trim());
        string img = "/assets/images/product/" + model + ".jpg";
        //if (file.HasFile)
        //{
        //    string img = DateTime.Now.ToString("yyyyMMddHHis") + file.FileName;
        //    file.PostedFile.SaveAs(Server.MapPath("~/uploads/") + img);
        //}
        string content = Request.Form["content"].Trim();

        //response.write(foreign_url == "");
 
        string settop = Request.Form["settop"] != null ? Request.Form["settop"].Trim() : "0";
        string sql = "update ss_product set name = '" + subject + "',model='" + model + "',eventdate='" + eventdate + "',ss_product.type='" + type + "',ss_product.pdesc='" + content + "',istop='" + settop + "',catid='" + catid + "'";
        sql += " WHERE id=" + Convert.ToInt32(Request.Form["id"].Trim());
        if (this.db.executesql(sql))
        {
            Response.Write("<script type='text/javascript'>alert('您执行的操作成功了!')</script>");
            Response.Write("<script>history.go(-2);</script>");
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert('您执行的操作失败了!');history.go(-1);</script>");
        }
    }
}
